#pragma once

// The model template class, the type T is the type of vertices
// this model will hold.
template <typename T>
class Model
{
public:
	Model()
	{
	}

	// Reserva memoria para los buffers y los inicializa.
	void InitializeBuffers(int vertexCount, int indexCount)
	{
		this->vertexCount = vertexCount;
		this->indexCount = indexCount;

		vertices = new T[vertexCount];
		indices = new int[indexCount];
	}

	// Establece el buffer de vertices, el destructor de Model
	// llamara delete[] al buffer.
	void SetVertexBuffer(int vertexCount, T *vertices)
	{
		this->vertexCount = vertexCount;
		this->vertices = vertices;
	}

	// Establece el buffer de indices, el destructor de Model
	// llamara delete[] al buffer.
	void SetIndexBuffer(int indexCount, int *indices)
	{
		this->indexCount = indexCount;
		this->indices = indices;
	}

	~Model(void)
	{
		delete[] vertices;
		delete[] indices;
	}

	int GetVertexCount()
	{
		return vertexCount;
	}

	int GetIndexCount()
	{
		return indexCount;
	}

	T* GetVertices()
	{
		return vertices;
	}

	int* GetIndices()
	{
		return indices;
	}

private:
	int vertexCount;
	int indexCount;

	// Buffers.
	T *vertices;
	int *indices;
};
